﻿Namespace Compiler.Semantic

    ''' <summary>
    ''' A container of names, its children will have the qualifier of containers' name.
    ''' </summary>
    ''' <remarks></remarks>
    Public MustInherit Class NameContainer
        Private m_Name As Symbol

        Public Property Name() As Symbol
            Get
                Return m_Name
            End Get
            Set(ByVal value As Symbol)
                m_Name = value
            End Set
        End Property

        Public Overridable ReadOnly Property IdentifyBinder() As Binder
            Get
                Return New SymbolBinder(Name)
            End Get
        End Property

        Private m_parent As NameContainer

        Public ReadOnly Property Parent() As NameContainer
            Get
                Return m_parent
            End Get
        End Property

        Protected Sub New(ByVal parent As NameContainer)
            m_parent = parent
        End Sub

        ''' <summary>
        ''' The qualifier of sub nodes.
        ''' </summary>
        Public MustOverride ReadOnly Property QualifiedName() As Qualifier

        Public MustOverride Function SearchChild(ByVal childBinder As Binder) As NameContainer
    End Class

End Namespace